﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class _Default : System.Web.UI.Page
{
	private SqlConnection _connection = new SqlConnection("server=127.0.0.1;uid=sa;pwd=;database=NorthwindCHS");

	protected void Page_Load(object sender, EventArgs e)
	{
		if (!Page.IsPostBack)
		{
			BindGridView();
		}
	}

	private void BindGridView()
	{
		DataSet ds = new DataSet();
		SqlDataAdapter da = new SqlDataAdapter(@"SELECT 产品ID, 类别名称,产品名称,产品.类别ID,单价,库存量
														FROM 产品,类别
														WHERE 产品.类别ID=类别.类别ID", _connection);
		da.Fill(ds, "Product");
		gdvProduct.DataSource = ds;
		gdvProduct.DataBind();

	}
}
